<template>
<div class="recycle-distributorUser views-container">
    <div class="wlm-table">
        <div class="wlm-table-header">
            <el-form :model="tableFormatData.userTable.files" size="small" label-width="80px" class="retail-form" label-position="right">
                <el-form-item label="" class="filter">
                    <el-form-item label="姓名：" class="search">
                        <el-input v-model="tableFormatData.userTable.files.real_name" placeholder="请输入姓名" style="width:175px;"></el-input>
                    </el-form-item>
                    <el-form-item label="电话：" class="search">
                        <el-input v-model="tableFormatData.userTable.files.mobile" placeholder="请输入电话" style="width:175px;"></el-input>
                    </el-form-item>
                </el-form-item>
                <el-form-item label="用户：" class="search">
                    <el-input v-model="tableFormatData.userTable.files.nickName" placeholder="请输入用户" style="width:175px;"></el-input>
                </el-form-item>
                <el-form-item label="" class="filter-btns">
                    <el-button type="primary" @click="filesSerch">筛选</el-button>
                    <el-button type="text" @click="filesEmpty">清空筛选条件</el-button>
                </el-form-item>
            </el-form>
        </div>
        <div class="wlm-table-content">
            <el-table :ref="tableFormatData.userTable.key" :data="tableFormatData.userTable.tableData" @selection-change="handleSelectionChange" style="width: 100%">
                <el-table-column type="selection" width="55">
                </el-table-column>
                <el-table-column prop="date" label="用户" >
                    <template slot-scope="scope">
                        <div class="wlm-table-logos">
                            <img class="logo" :src="scope.row.avatarUrl">
                            <div class="inner-text">
                                <p>{{scope.row.nickName}}</p>
                                <span>ID:{{scope.row.user_id}}</span>
                            </div>
                        </div>
                    </template>
                </el-table-column>
                <el-table-column prop="name" label="姓名" >
                    <template slot-scope="scope">
                        <span>{{scope.row.real_name}}</span>
                    </template>
                </el-table-column>
                <el-table-column prop="name" label="电话" >
                    <template slot-scope="scope">
                        <span>{{scope.row.mobile}}</span>
                    </template>
                </el-table-column>
                <el-table-column prop="name" label="累计佣金/可提现佣金" >
                    <template slot-scope="scope">
                        <p>{{scope.row.total_money}}</p>
                        <p>{{scope.row.money}}</p>
                    </template>
                </el-table-column>
                <el-table-column prop="name" label="下级用户" >
                    <template slot-scope="scope">
                        <p>一级用户：{{scope.row.first_num}}</p>
                        <p>二级用户：{{scope.row.second_num}}</p>
                        <p>三级用户：{{scope.row.third_num}}</p>
                    </template>
                </el-table-column>
                <el-table-column prop="name" label="成为时间" >
                    <template slot-scope="scope">
                        <span>{{ scope.row.create_time }}</span>
                    </template>
                </el-table-column>
                <el-table-column label="操作" >
                    <template slot-scope="scope">
                        <div class="operation-group">
                            <el-button class="wlm-text" type="text" @click="changeTableItem({ids:[scope.row.user_id],type:'dealer_user'},tableFormatData.userTable.change.restore)">恢复</el-button>
                            <div class="btn-line"></div>
                            <el-button class="wlm-text" type="text" @click="delTableItem(scope.row.user_id)">删除</el-button>
                        </div>
                    </template>
                </el-table-column>
            </el-table>
            <div class="pagination-content flex-row flex-justify-b flex-align-c">
                <el-row class="pagination-btns">
                    <el-checkbox class="check-all" true-label="1" false-label="0" v-model="tableFormatData.userTable.files.checkall" @change="toggleSelection">全部</el-checkbox>
                    <el-button class="right-8" type="primary" :disabled="isGroup" size="mini" @click="changeTableItem({isGroup:true,type:'dealer_user'},tableFormatData.userTable.change.restore)">批量恢复</el-button>
                    <el-button class="right-8" :disabled="isGroup" size="mini" @click="delTableList">删除</el-button>
                </el-row>
                <el-pagination :disabled="!hasTableData" @size-change="listPageChange" @current-change="listPageChange" :current-page.sync="tableFormatData.userTable.pagination.page" :page-sizes="tableFormatData.userTable.pagination.pagesizes" :page-size.sync="tableFormatData.userTable.pagination.list_rows" layout="total, sizes, prev, pager, next, jumper" :total="hasTableData?tableFormatData.userTable.pagination.total : 0">
                </el-pagination>
            </div>
        </div>
    </div>
</div>
</template>

<script>
import {
  getDelDealerUserList,
  recoveryDeletedInfo,
  deleteThoroughlyInfo
} from '@/api/recycle'
import mixins from '@/mixins/mixins'
export default {
  mixins: [mixins.getters('Table')],
  name: 'RecycleDistributorUser',
  components: {

  },
  data() {
    return {
      tableFormatData: {
        current: 'userTable',
        userTable: {
          key: 'userTable',
          api: {
            getList: getDelDealerUserList,
            delList: deleteThoroughlyInfo,
            msgConfig: {
              del: {
                type: 'warning',
                msg: '此操作会删除用户的所有数据，名下所有平台内如有正在交易的订单、金额，删除后所产生的纠纷由服务商自身承担 如要删除请慎重操作！！'
              }
            }
          },
          tableData: [],
          files: {
            // nickName: '',
            // real_name: '',
            // mobile: '',
            ids: [],
            checkall: '0',
            Recycle: '1',
            redirect: 'user_id',
            type: 'dealer_user'
          },
          change: {
            restore: {
              name: '恢复',
              key: 'restore',
              api: recoveryDeletedInfo
            }
          },
          pagination: {
            page: 1,
            list_rows: 10,
            pagesizes: [10, 20, 50],
            total: 0
          }
        }
      }
    }
  },
  methods: {

  }
}
</script>
